<?php
/**
 * 
 * Modelo de SMS_DetalleCI
 * @author Natanael
 * 
 */
class DetalleCi extends Model{

           private $_nameTable = "SMS_DetalleCI";
           
           public function __construct()
           {
                parent::Model();
                $this->load->database();
           }
           
           public function loadRegistro($where = false)
           {
               if ($where != false)
                    $query = $this->db->get_where($this->_nameTable, $where);
               else 
                   $query = $this->db->get($this->_nameTable);   
                 
                 return $this->getArrayFromQueryResult($query);
           }
         
           private function getArrayFromQueryResult($result)
           {
               if ($result->num_rows() == 0)
				         return false;
	
			        $data_arr = array();
	
			    foreach ($result->result() as $record) {
			    	
				      $data_arr[] = new SMSDetalleCI($record);
		        }
	
			   return $data_arr;
            }
         
            public function addRegistro($data)
            {
               if ($this->db->insert($this->_nameTable, $data))
                  return true;
               else  
                  return false;  
             }

}

class SMSDetalleCI{

       private $_idSmsHeaderCi = 0;
       private $_telefono = "";
       private $_referencia = "";
       private $_contacto = "";
       private $_etapa = 0;
       
       public function __construct($ojt)
       {
          $this->setIdSmsHeaderCi($ojt->IdSmsHeaderCi);
          $this->setTelefono($ojt->Telefono);
          $this->setReferencia($ojt->Referencia);
          $this->setContacto($ojt->Contacto);
          $this->setEtapa($ojt->Etapa);
       }
       
       public function getIdSmsHeaderCi()
       {
          return $this->_idSmsHeaderCi;
       }
       
       public function setIdSmsHeaderCi($value)
       {
          $this->_idSmsHeaderCi = $value;
       }
       
       public function getTelefono()
       {
          return $this->_telefono;
       }
       
       public function setTelefono($value)
       {
          $this->_telefono = $value;
       }
       
       public function getReferencia()
       {
          return $this->_referencia;
       }
       
       public function setReferencia($value)
       {
          $this->_referencia = $value;
       }
       
       public function getContacto()
       {
          return $this->_contacto;
       }
       
       public function setContacto($value)
       {
          $this->_contacto = $value;
       }
       
       public function getEtapa()
       {
          return $this->_etapa;
       }
       
       public function setEtapa($value)
       {
          $this->_etapa = $value;
       }

}